Specifying Which Messages Your Extension Overrides
You must include an override ('over'
) resource in your printing extension file to provide QuickDraw GX with a list of the messages that your printing extension is overriding. Each entry in the override resource specifies a message and information about the resource in which the code segment for the message override is found. You typically include separate override resources for universal messages and for messages specific to an imaging system, as shown in Listing 2-24.The code segment information for each message includes the resource ID of the code segment and the offset into the code segment for the instruction to jump to the message override function. The first 4 bytes of the code segment are reserved for use by QuickDraw GX and must be 0; thus, the first offset location is 4.
Each override resource in a printing extension has an ID of 0 for messages specific to an imaging system and an ID of
gxExtensionOverrideID
(-1) for universal messages. Unlike printer drivers, printing extensions may not override messages that QuickDraw GX sends to ensure compatibility with the Macintosh Printing Manager.Listing 2-24 Override resources for a printing extension
#define segmentID NewSegmentID /* defined as part of the make */ #define firstOffset 4 #define kRasterMsgsOVerrideID gxPrintingDriverBaseID+1 resource gxOverrideType (gxExtensionUniversalOverrideID, sysHeap, purgeable) { { gxInitialize, segmentID, firstOffset+0, gxShutDown, segmentID, firstOffset+4, gxDespoolPage, segmentID, firstOffset+8, gxSetupImageData, segmentID, firstOffset+12, gxOpenConnection, segmentID, firstOffset+16, gxCloseConnection,segmentID, firstOffset+20, gxStartSendPage, segmentID, firstOffset+24, gxFinishSendPage, segmentID, firstOffset+28, gxDefaultPrinter, segmentID, firstOffset+32, gxWriteData, segmentID, firstOffset+36, gxCheckStatus, segmentID, firstOffset+40, gxGetDeviceStatus,segmentID, firstOffset+44, gxCreateImageFile,segmentID, firstOffset+48, gxFetchTaggedData,segmentID, firstOffset+52, }; }; resource gxOverrideType (gxExtensionImagingOverrideID, sysHeap, purgeable) { { gxRasterDataIn, segmentID, firstOffset+56, gxRasterLineFeed, segmentID, firstOffset+60, }; };The first resource in Listing 2-24 lists the universal messages that the extension overrides, and the second resource specifies the messages that are specific to a raster imaging system and that the extension overrides. Each message listed in the resources specifies the name of the message, the ID of that segment, and where to find the message in the jump table. The ID of the code segment for all of these messages is defined by the constantsegmentID
. The jump statements to the code that implements the overrides are each 4 bytes long. The first is found at the first offset location (byte 4), and each subsequent jump statement is found 4 bytes beyond the previous one.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help